<script lang="ts">
import {defineComponent} from 'vue'
import DialogAndBlock from "@/components/DialogAndBlock/index.vue";
import {cloneDeep} from "lodash-es";
import fileReq from "@/api/file";
import {ElMessage} from "element-plus";

export default defineComponent({
  name: "Edit",
  components: {DialogAndBlock},
  data() {
    return {
      row: {} as any,
    }
  },
  emits: ['success'],
  methods: {
    open(row) {
      this.row  = cloneDeep(row)
      this.$refs.DialogRef.open()
    },
    updateClick() {
      fileReq.shareFileUpdate(this.row)
        .then(res=>{
          this.$emit('success')
          ElMessage.success(res.data as string)
          this.$refs.DialogRef.close()
          this.row = {}
        })
    }
  }
})
</script>

<template>
  <DialogAndBlock
    ref="DialogRef"
    title="文件分享"
  >
    <div>分享的文件：{{row.filePath}}</div>
    <div style="margin-top: 20px;margin-bottom: 20px;">
      <el-date-picker
        v-model="row.entTime"
        type="datetime"
        value-format="YYYY-MM-DD HH:mm:ss"
        placeholder="选择结束时间"
      />
    </div>
    <div style="text-align: right">
      <el-button
        type="primary"
        @click.stop="updateClick"
      >
        修改
      </el-button>
    </div>
  </DialogAndBlock>
</template>

<style scoped lang="scss">

</style>
